﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Runtime.InteropServices;
using Microsoft.VisualStudio.Shell;
using System.Windows.Forms;
using Microsoft.Win32;

namespace GordonKristan.codeclean
{
	[ClassInterface(ClassInterfaceType.AutoDual)]
	[CLSCompliant(false), ComVisible(true)]
	[Guid("B15D9C4A-8CE3-41e8-BC76-EF45CF2A7A81")]
	public class OptionsPageStyle : DialogPage
	{
		public OptionsPageStyle()
		{
			//Enter default values for the options
			RemoveWhitespaceAtBottom = true;
			RemoveWhitespaceAtBottomExceptNewline = true;
			RemoveWhitespaceAtTop = true;
			RemoveWhitespaceEndLine = true;
			RemoveConsecutiveBlankLines = true;
			RemoveBlankAfterBrace = false;
			RemoveBlankBeforeBrace = false;
			InsertLineAfterMethod = false;
		}

		[Category("CodeClean")]
		[DisplayName("Remove whitespace at the end of the file")]
		[Description("When styling code, remove any whitespace at the very end of the file.")]
		public bool RemoveWhitespaceAtBottom { get; set; }

		[Category("CodeClean")]
		[DisplayName("Except a single new line")]
		[Description("When removing end of file whitespace, leave a single new line.")]
		public bool RemoveWhitespaceAtBottomExceptNewline { get; set; }

		[Category("CodeClean")]
		[DisplayName("Remove whitespace at the beginning of the file")]
		[Description("When styling code, remove any whitespace at the very beginning of the file.")]
		public bool RemoveWhitespaceAtTop { get; set; }

		[Category("CodeClean")]
		[DisplayName("Remove whitespace at the end of each line")]
		[Description("When styling code, remove any whitespace at the end of a line.")]
		public bool RemoveWhitespaceEndLine { get; set; }

		[Category("CodeClean")]
		[DisplayName("Remove multiple consecutive blank lines")]
		[Description("When styling code, remove all sets of blank lines and leave only a single blank line.")]
		public bool RemoveConsecutiveBlankLines { get; set; }

		[Category("CodeClean")]
		[DisplayName("Remove blank lines after opening brace")]
		[Description("When styling code, remove all blank lines after opening braces.")]
		public bool RemoveBlankAfterBrace { get; set; }

		[Category("CodeClean")]
		[DisplayName("Remove blank lines before closing brace")]
		[Description("When styling code, remove all blank lines before closing braces.")]
		public bool RemoveBlankBeforeBrace { get; set; }

		[Category("CodeClean")]
		[DisplayName("Insert a blank line after all function definitions")]
		[Description("Ensure that every function definition has a blank line after it.")]
		public bool InsertLineAfterMethod { get; set; }

		/// <summary>
		/// Gets the window this options page will use for its UI.
		/// </summary>
		protected override IWin32Window Window
		{
			get { return new OptionsPageStyleControl(this); }
		}
	}
}
